# coding=utf-8
# 读取pages
import os, re

from test.file.util import listDir

_root_path = "/Users/wangjian/Downloads/tom/src/pages"


def getPageEle(name, path, _pages):
    _data = {}
    _data['page_name'] = str(name).split('.')[0]
    _data['page_path'] = str(path).replace(_root_path, '').split('.')[0]
    _pages.append(_data)
    pass


def main(_path, _pages, _sys):
    _list = []
    # 找到目录下有多少个文件
    listDir(None, _path, _list)
    for file in _list:
        name = file['name']
        path = file['path']
        if str(name).__contains__('Event'):
            continue
        getPageEle(name, path, _pages)
    pass


if __name__ == '__main__':
    _pages = []
    _sys = "tom"
    _path = '%s/UPS/WarehouseManage' % _root_path
    main(_path, _pages, _sys)

    for page in _pages:
        print page
